﻿@using Microsoft.AspNetCore.Identity
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - HttpTaskScheduler</title>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
    <script src="~/lib/jquery/dist/jquery.js"></script>
    <style>
        body {
            padding-top: 60px;
        }
        .navbar-brand {
            font-weight: bold;
        }
        .badge {
            font-size: 0.9em;
        }
        .form-group {
            margin-bottom: 15px;
        }
        .table-actions {
            white-space: nowrap;
        }
    </style>
</head>
<body>
    <header>
        <nav class="navbar navbar-expand-sm navbar-dark bg-dark fixed-top">
            <div class="container">
                <a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Task Scheduler</a>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
                    <ul class="navbar-nav flex-grow-1">
                        <li class="nav-item">
                            <a class="nav-link" asp-area="" asp-controller="Tasks" asp-action="Index">Tasks</a>
                        </li>
                        @if (SignInManager.IsSignedIn(User))
                        {
                            var user = await UserManager.GetUserAsync(User);
                            if (user != null && user.IsAdmin)
                            {
                                <li class="nav-item">
                                    <a class="nav-link" asp-controller="Account" asp-action="UserList">Users</a>
                                </li>
                            }
                        }
                    </ul>
                    <partial name="_LoginPartial" />
                </div>
            </div>
        </nav>
    </header>
    <div class="container">
        <main role="main" class="pb-3">
            @RenderBody()
        </main>
    </div>

    <footer class="border-top footer text-muted">
        <div class="container">
            &copy; @DateTime.Now.Year - HttpTaskScheduler
        </div>
    </footer>

    <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
    @await RenderSectionAsync("Scripts", required: false)
</body>
</html>